//
//  ViewController.m
//  Bunoff
//
//  Created by Stephen Tran on 4/25/14.
//  Copyright (c) 2014 STEPHENTRAN. All rights reserved.
//

#import "ViewController.h"
#import "ProfileViewController.h"
#import "FBManager.h"
#import "AppDelegate.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.user = [[User alloc] init];
	[[FBManager getInstance] checkFBToken];
}

- (void) openLoginForm
{
//    AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
//    [appDelegate.navigationController popToRootViewControllerAnimated:YES];
    [self performSegueWithIdentifier:@"loginSegue" sender:self] ;
}
- (void) openProfile
{
//    AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
//    [appDelegate.navigationController popToRootViewControllerAnimated:YES];
    [self performSegueWithIdentifier:@"profileSegue" sender:self] ;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
    
    if ([segue.identifier isEqualToString:@"profileSegue"]) {
        ProfileViewController *profileView = segue.destinationViewController;
        profileView.user = self.user;
    }
    else if([segue.identifier isEqualToString:@"loginSegue"]){
        
        
    }
    else{
        //no segue to push
    }
}
@end
